from urllib import parse

username = '15109277634'
password = 'Tiger@123456'


class Config(object):
    @staticmethod
    def get_login_url():
        return {
            'url': 'https://passport.weibo.cn/sso/login',
            'method': 'POST',
            'data': {
                'username': username,
                'password': password,
                'savestate': '1',
                'r': '',
                'ec': '0',
                'pagerefer': 'http://weibo.cn/',
                'entry': 'mweibo',
                'wentry': '',
                'loginfrom': '',
                'client_id': '',
                'code': '',
                'qq': '',
                'mainpageflag': '1',
                'hff': '',
                'hfp': '',
            },
            'headers': None
        }

    @staticmethod
    def get_search_url(_keyword):
        search_url = 'https://m.weibo.cn/api/container/getIndex?'
        search_data = {
            'type': 'all',
            'queryVal': _keyword,
            'luicode': '10000011',
            'lfid': '106003type=1',
            'title': _keyword,
            'containerid': '100103type=3&q=' + _keyword + '&t=0'
        }

        return {
            'url': search_url + parse.urlencode(search_data),
            'method': 'GET',
            'data': None,
            'headers': None
        }

    @staticmethod
    def get_home_container_id_url(_id):
        str_url = 'https://m.weibo.cn/api/container/getIndex?type=uid&value={}'
        return {
            'url': str_url.format(_id),
            'method': 'GET',
            'data': None,
            'headers': None
        }

    @staticmethod
    def get_blogs_url(cid, page):
        str_url = 'https://m.weibo.cn/api/container/getIndex?type=uid&containerid={}&page={}'
        return {
            'url': str_url.format(cid, page),
            'method': 'GET',
            'data': None,
            'headers': None
        }

url_config = Config()

random_agent = [
    "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36",
    "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14",
    "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)"
]

log_proxy = {
    "http": "http://192.168.2.170:8001",
    "https": "http://192.168.2.170:8001"
}


